home *** CD-ROM | disk | FTP | other *** search
/ Clickx 115 / Clickx 115.iso / software / tools / windows / tails-i386-0.16.iso / live / filesystem.squashfs / etc / bash_completion.d / kldload < prev    next >
Encoding:
Text File  |  2010-11-16  |  756 b   |  40 lines

  1. # bash completion for FreeBSD kernel module commands
  2.  
  3. [ $UNAME = FreeBSD ] &&
  4. {
  5.  
  6. _kldload()
  7. {
  8.     local cur moddir
  9.  
  10.     moddir=/modules/
  11.     [ -d $moddir ] || moddir=/boot/kernel/
  12.     _get_comp_words_by_ref cur
  13.  
  14.     COMPREPLY=( $( compgen -f "$moddir$cur" ) )
  15.     COMPREPLY=( ${COMPREPLY[@]#$moddir} )
  16.     COMPREPLY=( ${COMPREPLY[@]%.ko} )
  17.  
  18.     return 0
  19. }
  20. complete -F _kldload -o filenames kldload
  21.  
  22. _kldunload()
  23. {
  24.     local cur
  25.     _get_comp_words_by_ref cur
  26.     COMPREPLY=( $( kldstat | \
  27.         sed -ne "s/^.*[ \t]\{1,\}\($cur[a-z_]\{1,\}\).ko$/\1/p" ) )
  28. }
  29. complete -F _kldunload -o filenames kldunload
  30.  
  31. }
  32.  
  33. # Local variables:
  34. # mode: shell-script
  35. # sh-basic-offset: 4
  36. # sh-indent-comment: t
  37. # indent-tabs-mode: nil
  38. # End:
  39. # ex: ts=4 sw=4 et filetype=sh
  40.